// --------------------------------------------------------------------------------------------------------------------
// <copyright file="DbObjectViewModel.cs" company="Akzente.IT">
//   (c) 2012 Akzente.IT
// </copyright>
// <summary>
//   The DbObjectViewModel interface.
// </summary>
// --------------------------------------------------------------------------------------------------------------------

namespace AkzenteIT.DatabaseDocumentationTool.ViewModels.Base
{
    using Microsoft.SqlServer.Management.Smo;

    /// <summary>
    /// The db object view model.
    /// </summary>
    /// <typeparam name="T">
    /// The underlying database object type
    /// </typeparam>
    public abstract class DbObjectViewModel<T> : NodeViewModel, IDbObjectViewModel
        where T : ScriptNameObjectBase
    {
        #region Constructors and Destructors

        /// <summary>
        /// Initializes a new instance of the <see cref="DbObjectViewModel{T}"/> class.
        /// </summary>
        /// <param name="parent">
        /// The parent.
        /// </param>
        /// <param name="model">
        /// The model.
        /// </param>
        public DbObjectViewModel(NodeViewModel parent, T model)
            : base(parent)
        {
            this.Model = model;
        }

        #endregion

        #region Public Properties

        /// <summary>
        /// Gets or sets the description.
        /// </summary>
        public abstract string Description { get; set; }

        /// <summary>
        /// Gets the model.
        /// </summary>
        public T Model { get; private set; }

        #endregion

        #region Explicit Interface Properties

        /// <summary>
        /// Gets the model.
        /// </summary>
        ScriptNameObjectBase IDbObjectViewModel.Model
        {
            get
            {
                return this.Model;
            }
        }

        #endregion
    }
}